package com.shuwen.cdp.flink;

import com.shuwen.cdp.flink.db.ClickhouseImpl;
import com.shuwen.cdp.flink.model.DataEntity;
import com.alibaba.fastjson.JSON;

/**
 * @author lisw
 * @program jar-data-analysis-all
 * @description
 * @createDate 2022-05-20 22:08:31
 * @slogan 长风破浪会有时，直挂云帆济沧海。
 **/
public class Test {

    public static void main(String[] args) {
        try{
            String log = "{\"login_id\":\"23213322224533\",\"server_time\":1693291795416,\"lib\":{\"$lib\":\"js\",\"$lib_method\":\"code\",\"$lib_version\":\"1.23.3\"},\"ip\":\"0:0:0:0:0:0:0:1\",\"project\":\"production\",\"type\":\"track\",\"_track_id\":151323359,\"identities\":{\"$identity_cookie_id\":\"180f956d256dd4-0e66786133e6ff-34706704-1296000-180f956d257dd5\",\"$identity_anonymous_id\":\"sensors-family:125931\",\"$identity_login_id\":\"13675836046\"},\"distinct_id\":\"13675836046\",\"anonymous_id\":\"sensors-family:125931\",\"_flush_time\":1692700593359,\"time\":1692700593359,\"event\":\"sa_fe_perf\",\"properties\":{\"$latest_utm_medium\":\"cpc\",\"_session_referrer\":\"https://www.sensorsdata.cn/?utm_source=baidusem&utm_medium=cpc&utm_term=BDPZ-标题&utm_content=标题&utm_campaign=品专-左字\",\"app_version\":\"1.4.0.3874\",\"last_login_time\":\"2023-08-22 18:36:19\",\"perf_metric_fcp\":2649.300000000745,\"session_page_url\":\"https://www.sensorsdata.cn/demo/demo.html\",\"project\":\"电商\",\"$screen_height\":900,\"project_name\":\"EbizDemo\",\"isDemo\":true,\"is_demo\":true,\"$viewport_height\":783,\"perf_metric_tbt\":413,\"project_id\":9,\"perf_is_bounce_visit\":true,\"$latest_utm_campaign\":\"品专-左字\",\"$latest_search_keyword\":\"神策数据\",\"$latest_utm_term\":\"BDPZ-标题\",\"$url\":\"https://family.demo.sensorsdata.cn/dashboard/?project=EbizDemo&product=sbp_family&id=413&dash_type=lego\",\"$latest_referrer\":\"https://www.baidu.com/other.php\",\"perf_page_path\":\"https://family.demo.sensorsdata.cn/dashboard/?project=EbizDemo&product=sbp_family&id=413&dash_type=lego\",\"install_time\":\"2021-11-25\",\"project_cname\":\"电商\",\"perf_metric_fp\":1089.5999999977648,\"$is_first_day\":false,\"$viewport_width\":1440,\"$screen_width\":1440,\"expire_time\":\"2025-12-31 23:59:59\",\"$latest_utm_source\":\"baidusem\",\"version\":\"2.4.2.3364\",\"perf_metric_tti\":5666.89999999851,\"$lib\":\"js\",\"_session_referrer_host\":\"www.sensorsdata.cn\",\"version2\":\"2.4.2.3364\",\"$title\":\"神策数据\",\"$timezone_offset\":-480,\"$lib_version\":\"1.23.3\",\"version1\":\"2.4\",\"$latest_traffic_source_type\":\"付费广告流量\",\"seq_id\":\"MTY5MjcwMDU3NjEwOA==\",\"perf_metric_stbt\":1323,\"customer_id\":\"sensors-family\",\"$latest_utm_content\":\"标题\"}}";
            DataEntity dataEntity = new DataEntity();
            dataEntity = JSON.parseObject(log, DataEntity.class);

            ClickhouseImpl ck = new ClickhouseImpl();
            ck.open(null);
            ck.invoke(dataEntity,null);
        }catch (Exception e) {
            e.printStackTrace();
        }
    }

}
